<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>XJS</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="http://libs.useso.com/js/bootstrap/3.2.0/css/bootstrap.min.css" />
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
	<link rel="stylesheet" href="xrs.css" />
</head>
<body>
	<div class="">
		<input type="radio" name="myRadio" value="0" data-label="FOO|foo" checked />		<!-- id 可加可不加 -->
		<input type="radio" name="myRadio" value="1" data-label="BAR|bar" />
		<input type="radio" name="myRadio" value="2" data-label="BAZ|baz" />
	</div>
	
	<div class="foo">
		<button class="btn btn-default" onclick="init();">实例化</button>
		<button class="btn btn-danger" onclick="destroy();">删除</button>
	</div>
	
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="xrs.js"></script>

<script>
var _xrs = null;
$(function () {
	init();
});

function init() {
	if (_xrs)
		return false;
	_xrs = xrs("input:radio[name='myRadio']", {
		xRsLabelClass: 'xrs-label-info',
		iconEnable: true,
/*     	checkedIcon			: "fa fa-user",
    	uncheckedIcon		: "fa fa-cogs", */
	});
}

function destroy() {
	/* _xrs.destroy();*/ 
	_xrs = null;
	xrs("input:radio[name='myRadio']").destroy();
}
</script>
</body>
</html>
